clear;
close all;
clc;
cd("E:\Program Files\PROJECT\PRIVATE_PROJECT\robot\PRIVATE_PROJECT\ROBOT\KUKA\轨迹文件导入");
load joint_ts.mat;
diary ("JOINT_TS.dat");
disp('&ACCESS RVP')
disp('&REL 32')
disp('&PARAM EDITMASK = *')
disp('&PARAM TEMPLATE = C:\KRC\Roboter\Template\vorgabe')
disp('&PARAM DISKPATH = KRC:\R1\Program\liudong')
disp("DEFDAT JOINT_TS")%文件名
disp(';FOLD EXTERNAL DECLARATIONS;%{PE}%MKUKATPBASIS,%CEXT,%VCOMMON,%P')
disp(';FOLD BASISTECH EXT;%{PE}%MKUKATPBASIS,%CEXT,%VEXT,%P')
disp('EXT  BAS (BAS_COMMAND  :IN,REAL  :IN )')
disp('DECL INT SUCCESS')
disp(';ENDFOLD (BASISTECH EXT)')
disp(';FOLD USER EXT;%{E}%MKUKATPUSER,%CEXT,%VEXT,%P')
disp(';Make your modifications here')
fprintf('\n');
disp(';ENDFOLD (USER EXT)')
disp(';ENDFOLD (EXTERNAL DECLARATIONS)')
disp(['DECL BASIS_SUGG_T LAST_BASIS={POINT1[] "p' num2str(length(joint)) '",POINT2[] "' num2str(length(joint)) '",CP_PARAMS[] "CPDAT0",PTP_PARAMS[] "PDAT' num2str(length(joint)) '",CONT[] "C_DIS",CP_VEL[] "2.0",PTP_VEL[] "100",SYNC_PARAMS[] "SYNCDAT",SPL_NAME[] "S0",A_PARAMS[] "ADAT0"}']);
for i=1:length(joint)
disp(['DECL E6AXIS XP' num2str(i) '={A1 ' num2str(joint(i,1)) ',A2 ' num2str(joint(i,2)) ',A3 ' num2str(joint(i,3)) ',A4 ' num2str(joint(i,4)) ',A5 ' num2str(joint(i,5)) ',A6 ' num2str(joint(i,6)) ',E1 ' num2str(joint(i,7)) ',E2 ' num2str(joint(i,8)) ' ,E3 0.0,E4 0.0,E5 0.0,E6 0.0}'])
disp(['DECL FDAT FP' num2str(i) '={TOOL_NO 5,BASE_NO 2,IPO_FRAME #BASE,POINT2[] " ",TQ_STATE FALSE}'])
disp(['DECL PDAT PPDAT' num2str(i) '={VEL 100.000,ACC 100.000,APO_DIST 30.000,APO_MODE #CDIS,GEAR_JERK 30.0000,EXAX_IGN 0}'])
end
disp('ENDDAT')
diary off;

